﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Media.Imaging;
using CoiffeurProject.Utils;
using System.Windows.Media;

namespace CoiffeurProject.UserControls
{
    #region XButton

    internal class CloseButton
    {
        Button button;
        Window form;

        internal CloseButton(Window form, Thickness margin, int row, int column)
        {
            this.form = form;

            button = new Button()
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                Width = 40,
                Height = 40,
                Margin = margin,
                Content = new Image() { Source = new BitmapImage(new Uri(ImagesPath.XIcon)), Stretch = Stretch.Fill }
            };

            button.SetResourceReference(Button.StyleProperty, "NoChromeButton");
            button.Click += new RoutedEventHandler(button_Click);

            Grid.SetColumn(button, column);
            Grid.SetRow(button, row);
        }

        void button_Click(object sender, RoutedEventArgs e)
        {
            form.Close();
        }

        internal Control MainContainer
        {
            get { return button; }
        }
    }

    #endregion
}
